

class LookAtRequest:
    def __init__(self, height, latitude, longitude, locked=True, payload_index="89-0-0"):
        self._height = height
        self._latitude = latitude
        self._longitude = longitude
        self._locked = locked  #机头和云台的相对关系是否锁定
        self._payload_index = payload_index  # 相机枚举

    # Getter and Setter for height
    @property
    def height(self):
        return self._height

    @height.setter
    def height(self, value):
        if value < 0:
            raise ValueError("Height cannot be negative")
        self._height = value

    # Getter and Setter for latitude
    @property
    def latitude(self):
        return self._latitude

    @latitude.setter
    def latitude(self, value):
        if not (-90 <= value <= 90):
            raise ValueError("Latitude must be between -90 and 90")
        self._latitude = value

    # Getter and Setter for longitude
    @property
    def longitude(self):
        return self._longitude

    @longitude.setter
    def longitude(self, value):
        if not (-180 <= value <= 180):
            raise ValueError("Longitude must be between -180 and 180")
        self._longitude = value

    # Getter and Setter for locked
    @property
    def locked(self):
        return self._locked

    @locked.setter
    def locked(self, value):
        if not isinstance(value, bool):
            raise ValueError("Locked must be a boolean value")
        self._locked = value

    # Getter and Setter for payload_index
    @property
    def payload_index(self):
        return self._payload_index

    @payload_index.setter
    def payload_index(self, value):
        if not isinstance(value, str):
            raise ValueError("Payload index must be a string")
        self._payload_index = value

    def __repr__(self):
        return (f"LookAtRequest(height={self.height}, latitude={self.latitude}, "
                f"longitude={self.longitude}, locked={self.locked}, payload_index={self.payload_index})")

    def to_dict(self):
        """
        将对象转换为字典形式，方便序列化或传输。
        """
        return {
            "height": self.height,
            "latitude": self.latitude,
            "longitude": self.longitude,
            "locked": self.locked,
            "payload_index": self.payload_index
        }